﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace IOA.MES.Client.Common
{
    /// <summary>
    /// 请求返回对象
    /// </summary>
    public class ResultJson<T>
    {
        /// <summary>
        /// 未知错误
        /// </summary>
        public static int UnKnowErrCode = 500;
        public ResultJson()
        {
            ErrCode = 200;
            ErrMsg = string.Empty;
            Data = default(T);
            TotalCount = 0;
        }

        public ResultJson(int errCode, string errMsg)
        {
            ErrCode = errCode;
            ErrMsg = errMsg;
            Data = default(T);
            TotalCount = 0;
        }

        public ResultJson(T data, int totalCount = 0)
        {
            ErrCode = 200;
            ErrMsg = string.Empty;
            Data = data;
            TotalCount = totalCount;
        }

        /// <summary>
        /// 错误代码
        /// </summary>
        public int ErrCode { get; set; }

        /// <summary>
        /// 错误信息
        /// </summary>
        public string ErrMsg { get; set; }

        /// <summary>
        /// 返回数据
        /// </summary>
        public T Data { get; set; }

        /// <summary>
        /// 总数量
        /// </summary>
        public int TotalCount { get; set; }
    }
}
